<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>问卷编辑</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/dtree/dtree.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/dtree/font/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/darkBlue.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/work/question/question.css"/>
</head>
<body class="wrap-container clearfix">
<div class="column-content-detail">
    <div class="quesition-tj-tit">${question.title}</div>
    <div class="questionnaire-style-txt">
        <p>问卷类型：<span><#if question?? && question.type == '1'>扫码问卷<#else>对象问卷</#if></span>
            <#if question?? && question.type == '2'>
            问卷对象：<span><#if question?? && question.objectType == '1'>
                            所有人
                            <#elseif question?? && question.objectType == '2'>
                            教师
                            <#elseif question?? && question.objectType == '3'>
                            学生
                            <#else>
                            自定义对象
                            </#if>
                </span>
            </#if>
        </p>
        <p>开放时间：${question.startTime?string('yyyy-MM-dd')}~${question.endTime?string('yyyy-MM-dd')}</p>
        <#if question?? && question.remark !=null && question.remark !="">
        <p>问卷描述：<span>${question.remark}</span></p>
        </#if>
    </div>
    <div class="quesition-tj-list">
        <#if question.subjectList?? && (question.subjectList?size > 0)>
        <#list question.subjectList as subject>
        <#if subject.type == '1' || subject.type == '2'>
        <dl>
            <dt>${subject.orderNum}、${subject.title}<#if subject.type == '1'>[单选题]<#else>[多选题]</#if></dt>
            <#list subject.selectList as subjectSelect>
            <dd>
                <div>${subjectSelect.num}.${subjectSelect.title}</div>
                <div class="question-answer">
                    <span class="score">${subjectSelect.selectCount}</span>/<span class="scoret">${question.allCount}</span>
                </div>
            </dd>
            </#list>
        </dl>
        <#else>
        <dl>
            <dt>${subject.orderNum}、${subject.title}[简答题]</dt>
             <div class="question-jd-btn showSubjectDetail" data-id="${subject.id}">查看答案</div>
        </dl>
        </#if>
        </#list>
        </#if>
    </div>
<div class="layui-form-item">
    <div class="layui-input-block" style="margin-left: 0px !important;text-align: center">
        <button type="button" id="export" class="layui-btn layui-btn-primary">导出统计结果</button>
        <button type="button" id="exportP" class="layui-btn layui-btn-primary">导出明细</button>
        <button type="button" id="cancel" class="layui-btn layui-btn-primary">取消</button>
    </div>
</div>
</div>
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/lib/KnifeZ/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script>

    layui.use(['form', 'jquery', 'page', 'fileUtil', 'dialog', 'layer', 'layedit', 'baseutil'], function () {
        var $ = layui.jquery,
            form = layui.form,
            page = layui.page,
            fileUtil = layui.fileUtil,
            baseutil = layui.baseutil,
            layer = layui.layer,
            layedit = layui.layedit,
            dialog = layui.dialog;
        form.render();

        var id = '${question.id}';
        var parentMenuId = '${parentMenuId}';

        $('#cancel').bind('click', function () {
            if (id) {
                parent.tabDelete("total" + id);
            } else {
                parent.tabDelete('questionEdit');
            }
        });

        $("#export").on("click",function () {
            window.location.href = "/work/question/exportTotalExcel?questionId="+id;
        });

        $("#exportP").on("click",function () {
            window.location.href = "/work/question/exportUserScoreExcel?questionId="+id;
        });

        $('.quesition-tj-list .showSubjectDetail').on('click', function () {
            var subjectId = $(this).attr("data-id");
            page.edit(subjectId, '/work/question/getQuestionSubject?id=' + id + "&subjectId=" + subjectId, '问卷简答题');
        });

        answerNum();

        function answerNum() {
            // var numt=numAscore+numBscore+numCscore*1;
            //var scor
            $(".question-answer").each(function(){
                var score=$(this).find(".score").text();
                var scoreT=score*1/120;
                console.log(scoreT)
                if(scoreT>0.6||scoreT==0.6){
                    $(this).addClass("answer-bg-blue");
                }
                if(scoreT<0.6&&scoreT>0.2){
                    $(this).addClass("answer-bg-red");
                }
                else if(scoreT<0.2||scoreT==0.2){
                    $(this).addClass("answer-bg-yellow");
                }
            })
        }
    });

</script>
</body>
</html>